from proxypool.storages import StorageClient
from proxypool.schemas import Proxy
from proxypool.settings import REDIS_KEY
from proxypool.processors.tester import Tester
from proxypool.processors.getter import Getter

def test_storage():
    sc = StorageClient()
    db = sc.get_db()
    # 初始化数据
    for i in range(5):
        sc.add(Proxy('127.0.0.1', 9570 + i))
    db.expire(REDIS_KEY, 60)
    print(f'获取所有代理数据:{sc.all()}')

def test_tester():
    t = Tester()
    t.run()

def test_getter():
    getter = Getter()
    getter.run()    

if __name__ == '__main__':

    # 检测服务
    # test_crawler()
    # 检测检测模块
    test_tester()
    #检测构建
    # test_getter()